<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html>
<html>
<c:set value="${pageContext.request.contextPath }" var="cPath" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>board/boardEdit.jsp</title>
<LINK type="text/css" rel="stylesheet" href="${cPath }/css/main.css"/>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${cPath }/se2/js/HuskyEZCreator.js" charset="utf-8"></script>
</head>
<body>
<h4>답글달기</h4>
<div id="boardForm3" align="center">
<form action="${cPath }/boardqaInsert.do" 
	method="post" enctype="multipart/form-data"
	onsubmit="submitContents(this)" >
<input type="hidden" name="qa_no" value="${boardqa.qa_no }"/>
<input type="hidden" name="qa_group" value="${boardqa.qa_group }"/>
	<c:if test="${boardqa.qa_depth==1 }">
		<input type="hidden" name="qa_seq" value="${boardqa.qa_seq - (depthCount+1)*100 }"/>
	</c:if>
	<c:if test="${boardqa.qa_depth==2 }">
		<input type="hidden" name="qa_seq" value="${boardqa.qa_seq - (depthCount+1)*10 }"/>
	</c:if>
	<c:if test="${boardqa.qa_depth==3 }">
		<input type="hidden" name="qa_seq" value="${boardqa.qa_seq - (depthCount+1) }"/>
	</c:if>

<input type="hidden" name="qa_depth" value="${boardqa.qa_depth+1 }"/>

<table>
	<tr>
		<th>제목</th>
		<td>
			<INPUT type="text" id="text" name="qa_title" value="${boardqa.qa_title }"/>
		</td>
	</tr>
	<tr>
		<th>작성자</th>
		<td>
			<INPUT type="text" id="text" name="qa_writer"/>
		</td>
	</tr>
	<tr>
		<th>비밀번호</th>
		<td>
			<INPUT type="password" id="text" name="qa_pass"/>
		</td>
	</tr>
	<tr>
		<th>내용</th>
		<td>
			<TEXTAREA id="ir1" rows="5" cols="40" name="qa_content">${boardqa.qa_content }</TEXTAREA>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="submit" value="등록하기" onclick=""/>
			<input type="button" value="목록가기" onclick="window.location.href='${cPath}/boardqaList.do'"/>
		</td>
	</tr>
</table>
</form>
</div>
<script type="text/javascript">
	<c:if test="${!empty msg}">
		alert("${msg}");
	</c:if>
	
	var oEditors = [];
	nhn.husky.EZCreator.createInIFrame({
	    oAppRef: oEditors,
	    elPlaceHolder: "ir1",
	    sSkinURI: "${cPath}/se2/SmartEditor2Skin.html",
	    fCreator: "createSEditor2"
	});

	function submitContents(elClickedObj) {
		   // 에디터의 내용이 textarea에 적용된다.
		   oEditors[0].exec("UPDATE_CONTENTS_FIELD", []);
		 
		   // 에디터에 입력된 내용의 검증은 이곳에서
		   // document.getElementById("ir1").value 값을 이용해서 처리한다.
		 
		   try{
		       // 이 라인은 현재 사용 중인 폼에 따라 달라질 수 있다.
//	 	       elClickedObj.submit();
		   }catch(e){}
		}

</script>
</body>
</html>